import { Exclude } from 'class-transformer';
import { UserEntity } from 'src/user/entities/user.entity';
import {
  Column,
  Entity,
  JoinColumn,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';

@Entity('config_calc', { comment: '计算机设置项' })
export class ConfigCalcEntity {
  @Exclude()
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Exclude()
  @Column({ length: 36, comment: '用户id' })
  user_id: string;

  @ManyToOne(() => UserEntity)
  @JoinColumn({ name: 'user_id' })
  user: UserEntity;

  @Column({ type: 'tinyint', default: 1, comment: '是否震动，默认震动' })
  vibrate: number;

  @Column({ default: 10, comment: '震动强度，0-100级' })
  vibrate_rate: number;

  @Column({ type: 'tinyint', default: 1, comment: '是否静音，默认静音' })
  mute: number;

  @Column({ default: 2, comment: '保留小数位，默认2位' })
  precision: number;
}
